/**
 * ===========================================================================
 * 版权所有 湖南免了么网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.mianle.me
 * ===========================================================================
 * 21:00 2018/6/8
 */
package com.mianle.userapi.controller;

import com.mianle.userapi.service.GaodeService;
import com.mianle.userapi.service.RedisGeo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: yiyuan
 * @Description: 阿里验证码
 * @Date: Created in 21:00 2018/6/8
 *
 */
@Controller
@RequestMapping("ali")
public class AliyunVcode {

    @Autowired
    private GaodeService gaodeService;

    @Autowired
    private RedisGeo redisGeo;

    private static Logger logger = LoggerFactory.getLogger(AliyunVcode.class);
    private static final String ACCESS_KEY = "24856831";
    private static final String ACCESS_SECRET = "e60a64490b4d11c9e31fe01b3e5db986";
    //private static TaobaoClient client = null;

    static {
      //  client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", ACCESS_KEY, ACCESS_SECRET);
    }

    @RequestMapping("/verify")
    public ModelAndView verify(HttpServletRequest httpServletRequest) {
        String session = httpServletRequest.getParameter("csessionid");
        String sig = httpServletRequest.getParameter("sig");
        String token = httpServletRequest.getParameter("token");
        boolean success = true;
        try {
//            AlibabaSecurityJaqAfsCheckRequest req = new AlibabaSecurityJaqAfsCheckRequest();
//            req.setPlatform(3L);
//            req.setSessionId(session);
//            req.setToken(token);
//            req.setSig(sig);
//            AlibabaSecurityJaqAfsCheckResponse rsp = client.execute(req);

//            System.out.println("》》》》》》》》》》》》》》》》"+rsp.getBody());
//            System.out.println("---------"+rsp.toString());
//            System.out.println("++++++++"+rsp.getMsg());

        } catch (Exception e) {
            logger.error("验证服务出错！");
        }
        ModelAndView modelAndView = new ModelAndView("success");
        modelAndView.addObject("success", success);
        return modelAndView;
    }


}
